Sharing [config] data across modules,functions
Posted
by williamstw
on Stack Overflow
See other posts from Stack Overflow
or by williamstw
Published on 2010-03-24T15:30:40Z
Indexed on
2010/03/24
15:33 UTC
Read the original article
Hit count: 275
erlang
I have some configuration data in a config file that I read off disk when the app starts. I need to make that configuration data available to other functions/modules in the application. I started down the path of looking into ets/mnesia to store the data on startup to make it shared among all processes, but then my inner voice cautioned me that there must be a more functional, erlang-y way to do this. The only alternate approach I've come up with so far is setting up a module that has an actor loop that reads the data on startup and responds to messages like {Key, From} and responds by From ! {ok,Value}. Then, I gave up and decided to ask... Thanks, --tim
© Stack Overflow or respective owner